<?php

namespace mpend\modules\app\controllers;

use Yii;
use mpend\components\Controller;
use common\helpers\Url;
use common\helpers\ArrayHelper;
use mpend\modules\app\models\PackageViewSearch;

/**
 * 下载APP
 *
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class IssueController extends Controller {

    public $closeCheckAuthent = true;

    /**
     * {@inheritdoc}
     */
    protected function verbs() {
        return [
            '*' => ['GET'],
        ];
    }

    /**
     * 下载APP
     *
     * @inheritdoc
     */
    public function actionView($id) {
        return PackageViewSearch::findByUdid($id);
        $url = '/ipa/lnts/lnts.plist';
        return [
            'id' => Url::toShort($id),
            'name' => '鲁能体育',
            'brand' => Url::attach('https://appicon.pgyer.com/image/view/app_icons/0fa1d935be358ebc901d2adc9ca1e681/120'),
            'label' => [
                'type' => 'warning',
                'text' => '内测版',
            ],
            'platform' => [
                'icon' => 'logo-apple',
                'color' => '#000',
            ],
            'os' => 'ios',
            'build' => '5',
            'version' => '2.1.25',
            'size' => Yii::$app->formatter->asShortSize(54238825, 2),
            'package' => [
                'name' => 'cn.lnts.iosapp',
                'url' => Url::itms($url),
            ],
            'console' => [
                'text' => '点击安装',
                'size' => Yii::$app->formatter->asShortSize(54238825, 2),
                'updatetime' => Yii::$app->formatter->asRelativeTime(time()),
                'tips' => '正在安装，请按HOME键返回桌面查看',
            ],
            'updatetime' => Yii::$app->formatter->asRelativeTime(time()),
            'qrcode' => 'https://www.pgyer.com/app/qrcode/G28R'
        ];
    }

}
